package br.usp.ime.entities;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;


@SuppressWarnings("serial")
@Entity
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(
    name="FORM_ITEM_TYPE",
    discriminatorType=DiscriminatorType.STRING
)
@DiscriminatorValue("form_item")
@Table(name="evaluation_form_items")
public abstract class EvaluationFormItem implements Serializable {
    
    private Long id;
    private String name;
    private String value;   
    public EvaluationForm itemOwner;
    
    
    @Id
    @GeneratedValue
    @Column(name="ITEM_ID")
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    
    @Column(name="FORM_ITEM_NAME")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    
    @Column(name="FORM_ITEM_VALUE")
    public String getValue() {
        return value;
    }
    public void setValue(String value) {
        this.value = value;
    }
    
    @ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
    @JoinColumn(name = "FORM_ID")
    public EvaluationForm getEvaluationForm() {
        return itemOwner;
    }
    public void setEvaluationForm(EvaluationForm evaluationForm) {
        this.itemOwner = evaluationForm;
    }
    
    
    
    

}
